// 请求三级列表
import request from "@/utils/request"

// 三级分类的一级分类中某个item的类型
export interface category1ItemType {
    id:number,
    name:string
}
export type category1ListType = category1ItemType[];

// 三级分类的二级分类中某个item的类型
export interface category2ItemType {
    id:number,
    name:string,
    category1Id:number
}
export type category2ListType = category2ItemType[];

// 三级分类的三级分类中某个item的类型
export interface category3ItemType {
    id:number,
    name:string,
    category1Id:number
}
export type category3ListType = category3ItemType[];



// 请求一级列表  GET /admin/product/getCategory1
export const reqGetCategory1List = () => {
    return request.get<null,category1ListType>(`/admin/product/getCategory1`)
}

// 请求二级列表 GET /admin/product/getCategory2/{category1Id}
export const reqGetCategory2List = (category1Id:number) => {
    return request.get<null,category2ListType>(`/admin/product/getCategory2/${category1Id}`)
}

// 请求三级列表 GET /admin/product/getCategory3/{category2Id}
export const reqGetCategory3List = (category2Id:number) => {
    return request.get<null,category3ListType>(`/admin/product/getCategory3/${category2Id}`)
}